package com.oocl.euc.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

import com.oocl.euc.dao.impl.UserRepository;
import com.oocl.euc.entity.User;
import com.oocl.euc.pagination.PaginationService;
import com.oocl.euc.service.UserService;

@Service
public class UserServiceImpl extends PaginationService<User> implements UserService {
	@Autowired
	private UserRepository ur;
	@Override
	public Page<User> findAll(Integer limit, Integer page, String searchFilters, String sort) {
		return ur.findAll(getQuery(limit, page, searchFilters, sort));
	}

	@Override
	public Integer addUser(User user) {
		user.setCreateTime(new Date());
		return ur.save(user);
	}

}
